/*
 * Copyright 2019-2025 the original author or authors.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * https://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.iiifi.kite.captcha;

import java.io.Serializable;

import org.springframework.lang.Nullable;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * 验证码对象封装，用于传递到前端
 *
 * @author ii@iiifi.com 花朝
 */
@Getter
@ApiModel("验证码模型")
public class Captcha implements Serializable {
    /**
     * 用于传给前端，校验时携带
     */
    @ApiModelProperty("验证码唯一id")
    private final String uuid;
    /**
     * 图片 base64
     */
    @Setter
    @Nullable
    @ApiModelProperty("验证码图片（base64）")
    private String base64;
    /**
     * 图片 bytes
     */
    @Setter
    @Nullable
    @ApiModelProperty("验证码图片（bytes）")
    private byte[] bytes;

    Captcha(String uuid, String base64) {
        this.uuid = uuid;
        this.base64 = base64;
    }

    Captcha(String uuid, byte[] bytes) {
        this.uuid = uuid;
        this.bytes = bytes;
    }
}
